<template>
  <div class="table-filter card">
    <el-form ref="filterFormRef" inline :model="filterForm">
      <el-row :gutter="20">
        <el-col :span="4">
          <el-form-item prop="name" label="角色标识">
            <el-input v-model.trim="filterForm.name" placeholder="请输入角色标识" clearable />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item prop="label" label="角色名称">
            <el-input v-model.trim="filterForm.label" placeholder="请输入角色名称" clearable />
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item>
            <el-button type="primary" @click="submit">搜索</el-button>
            <el-button type="danger" @click="reset">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const emits = defineEmits(['submit', 'reset'])

const filterFormRef = ref()
// 过滤条件表单
const filterForm = ref({
  name: '',
  label: ''
})

// 提交
function submit() {
  emits('submit', filterForm.value)
}

// 重置
function reset() {
  filterFormRef.value.resetFields()
  emits('reset')
}
</script>

<style lang="scss"></style>
